import createAPI  from 'shared/utils/createAPI';

export default {
  getDatas: (param, pager) => {
    // const api = createGetAPI('');
    // const result = api();
    // return result;
    let { keyword } = param;
    const { page, pageSize } = pager;
    const total = keyword ? Number.parseInt(Math.random() * 10) : 200;
    const body = {
      filter: { keyword },
      pager: { page, pageSize, total },
      dataList: [],
    };
    keyword = keyword || '{{moduleText}}';
    const start = (page - 1) * pageSize;
    const end = (page) * pageSize;
    for (let i = start; i < end && i < total; i++) {
      body.dataList.push({
        id: i,
        name: `${keyword}${i}`,
        lastTime: '2017-07-26 13:42:33',
        lastUser: '张三三',
      });
    }
    return { body };
  }
};
